
package com.v1.video.activity;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.iss.view.common.ToastAlone;
import com.v1.video.R;
import com.v1.video.domain.LoginInfo;
import com.v1.video.domain.MessageSwitchPageInfo;
import com.v1.video.domain.OptionInfo;
import com.v1.video.domain.ResultInfo;
import com.v1.video.engine.NetEngine;
import com.v1.video.exception.ServicesException;
import com.v1.video.util.Helper;
import com.v1.video.util.Logger;
import com.v1.video.util.Utils;

/**
 * 消息提醒类；
 * 
 * @author Administrator
 */
public class OptionInformationTipsActivity extends BaseActivity {

    private final String TAG = "OptionInformationTipsActivity";

    private OptionInformationTipsActivity instance;

    // setText(Html.fromHtml("<u>"+"hahaha"+"</u>"));

    /** 标题 */
    TextView text_title;

    /** 返回按钮 */
    private ImageView view_btn_return;

    /** 接收消息按钮 */
    private RelativeLayout layoutInfoReceive;
    private ImageView btnInfoReceive;

    /** 是否接收消息 */
    public boolean isReceiveInfo = true;

    /** 评论消息按钮 */
    private RelativeLayout layoutInfoComment;
    private ImageView btnInfoComment;

    /** 是否接收评论消息 */
    public boolean isReceiveCommentInfo = true;

    /** @我  */
    private RelativeLayout layoutTidaoMe;
    private ImageView btnInfoTidaoMe;
    /** 是否接收@我 */
    public boolean isReceiveTidaoMe = true;
    
    /** 圈子私信提醒  */
    private RelativeLayout layoutCircleSixin;
    private ImageView btnInfoCircleSiXin;
    /** 是否接收圈子私信 */
    public boolean isReceiveSixin = true;
    
    /** 消息提示音按钮 */
    private RelativeLayout layoutInfoTips;
    private ImageView btnInfoTips;

    /** 是否开启消息提示音 */
    public boolean isReceiveTipsInfo = false;
    
    /** 我的私信  */
    private RelativeLayout layoutMySixin;
    private ImageView btnInfoMYSiXin;
    /** 是否接收我的私信 */
    public boolean isReceiveMySixin = true;
    
    /** 关注新帖  */
    private RelativeLayout layoutFocusXintie;
    private ImageView btnInfoFocusXintie;
    /** 是否接收关注新帖 */
    public boolean isReceiveFocusXintie = true;

//    /** 震动按钮 */
//    private RelativeLayout layoutInfoShake;
//    private ImageView btnInfoShake;
//
//    /** 是否开启消息提醒震动 */
//    public boolean isReceiveShakeInfo = false;

    /** 消息免打扰按钮 */
    private RelativeLayout layoutInfoDisturb;
    private ImageView btnInfoDisturb;

    /** 是否开启消息免打扰 */
    public boolean isInfoDisturbOn = false;

//    private ShopWheelViewDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_information_tips);
        instance = this;
    }

    @Override
    protected void initView() {
        // TODO Auto-generated method stub
        
        view_btn_return = (ImageView) findViewById(R.id.iv_result);
        text_title = (TextView) findViewById(R.id.tv_title);

        btnInfoReceive = (ImageView) findViewById(R.id.info_btn_receive);
        btnInfoComment = (ImageView) findViewById(R.id.info_btn_comment);
        btnInfoCircleSiXin = (ImageView) findViewById(R.id.info_btn_circle_sixin);
//        btnInfoCircleXinTie = (ImageView) findViewById(R.id.info_btn_circle_xintie);
        btnInfoTips = (ImageView) findViewById(R.id.info_btn_tips);
//        btnInfoShake = (ImageView) findViewById(R.id.info_btn_shake);
        btnInfoDisturb = (ImageView) findViewById(R.id.info_btn_disturb);
        layoutInfoReceive = (RelativeLayout) findViewById(R.id.info_receive_info_back);
        layoutInfoComment = (RelativeLayout) findViewById(R.id.info_comment_info_back);
        layoutCircleSixin = (RelativeLayout) findViewById(R.id.info_circle_sixin_back);
//        layoutCircleXinTie = (RelativeLayout) findViewById(R.id.info_circle_xintie_back);
        layoutInfoTips = (RelativeLayout) findViewById(R.id.info_info_tips_back);
//        layoutInfoShake = (RelativeLayout) findViewById(R.id.info_shake_back);
        layoutInfoDisturb = (RelativeLayout) findViewById(R.id.info_disturb_back);
        
        layoutTidaoMe = (RelativeLayout)findViewById(R.id.info_tidaome_back);
        btnInfoTidaoMe = (ImageView) findViewById(R.id.info_btn_tidaome);
        
        layoutMySixin = (RelativeLayout) findViewById(R.id.info_my_sixin);
        btnInfoMYSiXin = (ImageView) findViewById(R.id.info_btn_my_sixin);
        
        layoutFocusXintie = (RelativeLayout) findViewById(R.id.info_my_focous_xintie);
        btnInfoFocusXintie = (ImageView) findViewById(R.id.info_btn_focous_xintie);
    }

    @Override
    protected void initData() {
        // TODO Auto-generated method stub
        text_title.setText(R.string.info_title_tips);
//        dialog = new ShopWheelViewDialog(this);
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isFocusNotice()){
            btnInfoReceive.setImageResource(R.drawable.switch_on);
            isReceiveInfo = true; 
        }else{
            btnInfoReceive.setImageResource(R.drawable.switch_off);
            isReceiveInfo = false; 
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isCommentNotice()){
            btnInfoComment.setImageResource(R.drawable.switch_on);
            isReceiveCommentInfo = true;
        }else{
            btnInfoComment.setImageResource(R.drawable.switch_off);
            isReceiveCommentInfo = false;
        }
//        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isSystemNotice()){
//            btnInfoSystem.setImageResource(R.drawable.switch_on);
//            isReceiveSystemInfo = true;
//        }else{
//            btnInfoSystem.setImageResource(R.drawable.switch_off);
//            isReceiveSystemInfo = false;
//        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isCircleTidaoMe()){
            btnInfoTidaoMe.setImageResource(R.drawable.switch_on);
            isReceiveTidaoMe = true;
        }else{
        	btnInfoTidaoMe.setImageResource(R.drawable.switch_off);
        	isReceiveTidaoMe = false;
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isCircleSiXin()){
            btnInfoCircleSiXin.setImageResource(R.drawable.switch_on);
            isReceiveSixin = true;
        }else{
        	btnInfoCircleSiXin.setImageResource(R.drawable.switch_off);
        	isReceiveSixin = false;
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isMySiXin()){
            btnInfoMYSiXin.setImageResource(R.drawable.switch_on);
            isReceiveMySixin = true;
        }else{
        	btnInfoMYSiXin.setImageResource(R.drawable.switch_off);
        	isReceiveMySixin = false;
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isFocousXinTie()){
            btnInfoFocusXintie.setImageResource(R.drawable.switch_on);
            isReceiveFocusXintie = true;
        }else{
        	btnInfoFocusXintie.setImageResource(R.drawable.switch_off);
        	isReceiveFocusXintie = false;
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isNoticeAlarm()){
            btnInfoTips.setImageResource(R.drawable.switch_on);
            isReceiveTipsInfo = true;
        }else{
            btnInfoTips.setImageResource(R.drawable.switch_off);
            isReceiveTipsInfo = false;
        }
        if(OptionInfo.getInstance(OptionInformationTipsActivity.this).isNoticeDisturb()){
            btnInfoDisturb.setImageResource(R.drawable.switch_on);
            isInfoDisturbOn = true;
        }else{
            btnInfoDisturb.setImageResource(R.drawable.switch_off);
            isInfoDisturbOn = false;
        }
        
    }

    @Override
    protected void setListener() {
        // TODO Auto-generated method stub
        findViewById(R.id.lay_result).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                finish();
            }
        });
        btnInfoReceiveOnclick();

    }

    private void btnInfoReceiveOnclick() {
        layoutInfoReceive.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                if (isReceiveInfo) {
//                    btnInfoReceive.setImageResource(R.drawable.switch_off);
//                    isReceiveInfo = false;                    
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocusNotice(false);
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openFocuson","0").execute();
                    
                } else {
//                    btnInfoReceive.setImageResource(R.drawable.switch_on);
//                    isReceiveInfo = true;
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocusNotice(true);
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openFocuson","1").execute();                    
                }
            }
        });
        layoutInfoComment.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                if (isReceiveCommentInfo) {
//                    btnInfoComment.setImageResource(R.drawable.switch_off);
//                    isReceiveCommentInfo = false;
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setCommentNotice(false);
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openComment","0").execute(); 
                } else {
//                    btnInfoComment.setImageResource(R.drawable.switch_on);
//                    isReceiveCommentInfo = true;
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setCommentNotice(true);
//                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openComment","1").execute(); 
                }
            }
        });
        layoutInfoDisturb.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!isReceiveTipsInfo){
                    return;
                }
                if (isInfoDisturbOn) {
                    btnInfoDisturb.setImageResource(R.drawable.switch_off);
                    isInfoDisturbOn = false;
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setNoticeDisturb(false);
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                } else {
                    btnInfoDisturb.setImageResource(R.drawable.switch_on);
                    isInfoDisturbOn = true;
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setNoticeDisturb(true);
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//                    initTimesDialog();
                }
            }
        });
//        layoutInfoShake.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View arg0) {
//                // TODO Auto-generated method stub
//                if(!isReceiveInfo){
//                    return;
//                }
//                if(!isReceiveTipsInfo){
//                    return;
//                }
//                if (isReceiveShakeInfo) {
//                    btnInfoShake.setImageResource(R.drawable.switch_off);
//                    isReceiveShakeInfo = false;
//                } else {
//                    btnInfoShake.setImageResource(R.drawable.switch_on);
//                    isReceiveShakeInfo = true;
//                }
//            }
//        });
//        layoutInfoSystem.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View arg0) {
//                // TODO Auto-generated method stub
//                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
//                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
//                    return;
//                }
//                if (isReceiveSystemInfo) {                 
////                    btnInfoSystem.setImageResource(R.drawable.switch_off);
////                    isReceiveSystemInfo = false;
////                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setSystemNotice(false);
////                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openSystem","0").execute(); 
//                } else {
////                    btnInfoSystem.setImageResource(R.drawable.switch_on);
////                    isReceiveSystemInfo = true;
////                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setSystemNotice(true);
////                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openSystem","1").execute(); 
//                }
//            }
//        });
        layoutCircleSixin.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                if (isReceiveSixin) {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openGroupMessage","0").execute(); 
                } else {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openGroupMessage","1").execute(); 
                }
            }
        });
        layoutTidaoMe.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                if (isReceiveTidaoMe) {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openAt","0").execute(); 
                } else {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openAt","1").execute(); 
                }
            }
        });
        
        layoutMySixin.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                Logger.i(TAG, "我的私信");
                if (isReceiveMySixin) {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openPrivateLetter","0").execute(); 
                } else {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openPrivateLetter","1").execute(); 
                }
            }
        });
        layoutFocusXintie.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(!Helper.checkConnection(OptionInformationTipsActivity.this)){
                    ToastAlone.showToast(OptionInformationTipsActivity.this, getResources().getString(R.string.net_no), 1);
                    return;
                }
                Logger.i(TAG, "关注新贴");
                if (isReceiveFocusXintie) {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openVideoNew","0").execute(); 
                } else {
                    new SendDataAsync(LoginInfo.getInstance().getUserId(),"openVideoNew","1").execute(); 
                }
            }
        });
        layoutInfoTips.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
               
                if (isReceiveTipsInfo) {
                    btnInfoTips.setImageResource(R.drawable.switch_off);
                    isReceiveTipsInfo = false;
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setNoticeAlarm(false);
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                } else {
                    btnInfoTips.setImageResource(R.drawable.switch_on);
                    isReceiveTipsInfo = true;
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).setNoticeAlarm(true);
                    OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
                }
            }
        });
    }

//    /** 初始化时间段 */
//    private void initTimesDialog() {
//        DistrictInfo result = new DistrictInfo();
//        ArrayList<District> list = new ArrayList<District>();
//        int length = timeArr.length;
//        for (int i = 0; i < length; i++) {
//            District bean = new District();
//            bean.name = timeArr[i];
//            bean.linkageid = "0";
//            bean.parentid = "0";
//            list.add(bean);
//        }
//        result.list = list;
//        dialog.setData(result);
//        dialog.show(new ConfirmAction() {
//
//            @Override
//            public void doAction(District root, District child) {
//                // textView.setText(root.name+"|"+child.name);
//            }
//        });
//    }

    @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
    }

//    private String timeArr[] = {
//            "0:00", "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00",
//            "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00",
//            "19:00", "20:00", "21:00", "22:00", "23:00"
//    };
    SendDataAsync task = null;
    /**
     * 消息提醒上传
     */
    private class SendDataAsync extends AsyncTask<Void, Void, Boolean> {
        
        private String errorMsg = "";
        private String userId;
        private String typeId;
        private String type;
        private ProgressDialog pd;
        ResultInfo resultInfo = null;
        /**
         * 
         * @param userId            用户id
         * @param type       关注，评论，系统
         * @param typeld            (0关，1开)
         */
        public SendDataAsync(String userId, String type,String typeId) {
            this.userId = userId;
            this.typeId = typeId;
            this.type = type;
        }
        
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pd = Utils.getProgressDialog(OptionInformationTipsActivity.this,getResources().getString(R.string.get_data), this);
            pd.show();
        }
        
        @Override
        protected Boolean doInBackground(Void... params) {
            try {
                NetEngine engine = new NetEngine();
                resultInfo = engine.sendTipsOfMessage(userId, type, typeId);
            } catch (ServicesException e) {
                e.printStackTrace();
                errorMsg = e.getMessage();
            }
            return false;
            
        }
        
        @Override
        protected void onPostExecute(Boolean result) {
            super.onPostExecute(result);
            if(pd != null && pd.isShowing()){
                pd.cancel();
            }
            if (errorMsg.equals("")) {
                if(resultInfo.getCode().equals("0")){
                    updataSendResult(type,typeId);
                }else{
                    ToastAlone.showToast(OptionInformationTipsActivity.this, resultInfo.getMessage(), 1);
                }
            } else {
                ToastAlone.showToast(OptionInformationTipsActivity.this, errorMsg, 1);
            }
        }
    }
    
    /**
     * 消息提醒上传
     */
    private class SendDataAsync2 extends AsyncTask<Void, Void, Boolean> {
        
        private String errorMsg = "";
        private String userId;
        private String typeId;
        private String type;
        private ProgressDialog pd;
        MessageSwitchPageInfo resultInfo = null;
        /**
         * 
         * @param userId            用户id
         * @param type       关注，评论，系统
         * @param typeld            (0关，1开)
         */
        public SendDataAsync2(String userId, String type,String typeId) {
            this.userId = userId;
            this.typeId = typeId;
            this.type = type;
        }
        
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pd = Utils.getProgressDialog(OptionInformationTipsActivity.this,getResources().getString(R.string.get_data), this);
            pd.show();
        }
        
        @Override
        protected Boolean doInBackground(Void... params) {
            try {
                NetEngine engine = new NetEngine();
                resultInfo = engine.sendTipsOfMessage2(userId, type, typeId);
            } catch (ServicesException e) {
                e.printStackTrace();
                errorMsg = e.getMessage();
            }
            return false;
            
        }
        
        @Override
        protected void onPostExecute(Boolean result) {
            super.onPostExecute(result);
            if(pd != null && pd.isShowing()){
                pd.cancel();
            }
            if (errorMsg.equals("")) {
            	if(resultInfo != null){
	                if(resultInfo.getCode() == 0){
	                    updataSendResult(type,typeId);
	                }else{
	                    ToastAlone.showToast(OptionInformationTipsActivity.this, resultInfo.getMsg(), 1);
	                }
                }else{
                	ToastAlone.showToast(OptionInformationTipsActivity.this, "未知错误", 1);
                }
            } else {
                ToastAlone.showToast(OptionInformationTipsActivity.this, errorMsg, 1);
            }
        }
    }
    
    private void updataSendResult(String type,String typeId){
        if(type.equals("openFocuson")){
            if(typeId.equals("0")){
                btnInfoReceive.setImageResource(R.drawable.switch_off);
                isReceiveInfo = false;                    
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocusNotice(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
                btnInfoReceive.setImageResource(R.drawable.switch_on);
                isReceiveInfo = true;                    
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocusNotice(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }else if(type.equals("openComment")){
            if(typeId.equals("0")){
                btnInfoComment.setImageResource(R.drawable.switch_off);
                isReceiveCommentInfo = false;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCommentNotice(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
                btnInfoComment.setImageResource(R.drawable.switch_on);
                isReceiveCommentInfo = true;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCommentNotice(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }else if(type.equals("openGroupMessage")){
            if(typeId.equals("0")){
                btnInfoCircleSiXin.setImageResource(R.drawable.switch_off);
                isReceiveSixin = false;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleSiXin(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
            	btnInfoCircleSiXin.setImageResource(R.drawable.switch_on);
            	isReceiveSixin = true;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleSiXin(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }else if(type.equals("openGroupNew")){
//            if(typeId.equals("0")){
//                btnInfoCircleXinTie.setImageResource(R.drawable.switch_off);
//                isReceiveXinTie = false;
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleXinTie(false);
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//            }else{
//            	btnInfoCircleXinTie.setImageResource(R.drawable.switch_on);
//            	isReceiveXinTie = true;
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleXinTie(true);
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//            }
        }else if(type.equals("openAt")){
            if(typeId.equals("0")){
                btnInfoTidaoMe.setImageResource(R.drawable.switch_off);
                isReceiveTidaoMe = false;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleTidaoMe(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
            	btnInfoTidaoMe.setImageResource(R.drawable.switch_on);
            	isReceiveTidaoMe = true;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setCircleTidaoMe(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }else if(type.equals("openVideoNew")){//关注新贴
            if(typeId.equals("0")){
                btnInfoFocusXintie.setImageResource(R.drawable.switch_off);
                isReceiveFocusXintie = false;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocousXinTie(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
            	btnInfoFocusXintie.setImageResource(R.drawable.switch_on);
            	isReceiveFocusXintie = true;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setFocousXinTie(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }else if(type.equals("openPrivateLetter")){//我的私信
            if(typeId.equals("0")){
                btnInfoMYSiXin.setImageResource(R.drawable.switch_off);
                isReceiveMySixin = false;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setMySiXin(false);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }else{
            	btnInfoMYSiXin.setImageResource(R.drawable.switch_on);
            	isReceiveMySixin = true;
                OptionInfo.getInstance(OptionInformationTipsActivity.this).setMySiXin(true);
                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
            }
        }
//        else if(type.equals("openSystem")){
//            if(typeId.equals("0")){
//                btnInfoSystem.setImageResource(R.drawable.switch_off);
//                isReceiveSystemInfo = false;
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).setSystemNotice(false);
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//            }else{
//                btnInfoSystem.setImageResource(R.drawable.switch_on);
//                isReceiveSystemInfo = true;
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).setSystemNotice(true);
//                OptionInfo.getInstance(OptionInformationTipsActivity.this).saveData(OptionInformationTipsActivity.this);
//            }
//        }
    }
}
